#ifndef __P_ERROR_H__
#define __P_ERROR_H__

#include <string>

#include "p_types.h"

/**
 * This is the error_struct for containing error message and other related information. The whole compiler uses this
 * structure.
 *
 * @brief Stores the necessary information about a message.
 */
struct p_error_struct
{
   std::string msg;
   std::string file_name;
   p_unsigned_int line;
   p_unsigned_int col;
};

/**
 * This function creates a new p_error_struct instance.
 *
 * @param msg The message which is used to be displayed on the screen.
 * @param file_name The file name which is parsed and contains the error.
 * @param line The number of the line containing the error.
 * @param col The number of the column containing the wrong token.
 */
p_error_struct error_struct_create(const std::string &msg,
                                   const std::string &file_name,
                                   const p_unsigned_int &line,
                                   const p_unsigned_int &col);

/**
 * This functions creates a new error_struct object containing a message only.
 *
 * @param msg The message which is used to be displayed on the screen.
 */
p_error_struct error_struct_create(const std::string &msg);

/**
 * This function which converts a given struct into a string.
 *
 * @param error_struct The error structure which is used to generate an error message.
 */
std::string error_struct_to_string(const p_error_struct &error_struct);

#endif
